﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace array
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入一个数组： ");
            List<int> list = new List<int>();
            string [] arr =Console.ReadLine().Split(',');
            foreach (string str in arr)
            {
                list.Add(int.Parse(str));
            }
            Console.WriteLine("最大值为：" + getMax(list)+"；最小值为："+getMin(list)+"平均值为："+getAvg(list)+"总和为："+getSum(list));
            Console.ReadLine();
        }
        private static int getMax(List<int> list)
        {
            int max = list[0];
            for(int i = 1; i < list.Count; i++)
            {
                if(list[i] > max)max = list[i];
            }
            return max;
        }
        private static int getMin(List<int> list)
        {
            int min = list[0];
            for (int i = 1; i < list.Count; i++)
            {
                if (list[i] < min) min = list[i];
            }
            return min;
        }
        private static int getSum(List<int> list)
        {
            int sum = 0;
            for (int i = 0; i < list.Count; i++)
            {
                sum += list[i];
            }
            return sum;
        }

        private static int getAvg(List<int> list)
        {
            
            return getSum(list)/ list.Count;
        }
    }
}
